package com.ss.android.model;

import com.bytedance.common.utility.Logger;

import org.json.JSONArray;
import org.json.JSONObject;

public final class ItemActionV3 {
    public final long timestamp;
    public final String action;
    public int targetType;
    public final BaseArticle d;
    public long ad_id;
    public String json;
    public String logExtra;
    public boolean clicked;
    public JSONArray filterWords;
    public String extra;

    public ItemActionV3(String arg5, BaseArticle arg6, int arg7, long arg8, String json) {
        this.action = arg5;
        this.timestamp = arg8;
        this.d = arg6;
        this.targetType = arg7;
        this.json = json;
        if (!android.support.design.a.isTextEmpty(this.json)) {
            try {
                JSONObject jo = new JSONObject(this.json);
                if (this.b()) {
                    this.filterWords = new JSONArray(jo.optString("filter_words"));
                }

                if (this.c()) {
                    this.extra = jo.optString("extra");
                }

                if (jo.has("ad_id")) {
                    this.ad_id = jo.optLong("ad_id");
                }

                if (jo.has("clicked")) {
                    this.clicked = jo.optBoolean("clicked");
                }

                if (!jo.has("log_extra")) {
                    this.logExtra = jo.optString("log_extra");
                }
            } catch (Exception e) {
                Logger.e("ItemActionV3", "exception in extractExtra : " + e.toString());
            }
        }
    }

    public ItemActionV3(String arg8, long arg9, int arg11, long arg12) {
        this(arg8, new BaseArticle(arg9), arg11, arg12, null);
    }

    public final boolean a() {
        return (!android.support.design.a.isTextEmpty(this.action)) && this.d.groupId > 0 && this.timestamp > 0;
    }

    public final boolean b() {
        return "dislike".equals(this.action);
    }

    public final boolean c() {
        boolean v0 = true;
        if (this.targetType != 1 && this.targetType != 2) {
            v0 = false;
        }
        return v0;
    }
}

